package com.qz.c4;

import java.util.Scanner;

public class Smart_shopping {
    public static void main(String[] args) {
        int book=12;
        int pencil=1;
        int eraser=2;
        int coke=3;
        int snacks=5;
        int money=20;
        System.out.println("书本的价格为"+book+"元,总共有"+money+"元");
        System.out.println("铅笔的价格为："+pencil+"元");
        System.out.println("橡皮的价格为："+eraser+"元");
        System.out.println("可乐的价格为："+coke+"元");
        System.out.println("零食的价格为："+snacks+"元");
        System.out.println("请输入其他需要购买的商品的序列号");

        Scanner sc=new Scanner(System.in);
        int x=sc.nextInt();

        switch (x){
            case (1):
                System.out.println("购买完书本后还可以买铅笔"+(money-book)/pencil+"个,"+"还剩"+(money-pencil*(money/pencil))+"元");
                break;
            case (2):
                System.out.println("购买完书本后还可以买橡皮"+(money-book)/eraser+"个,"+"还剩"+(money-eraser*(money/eraser))+"元");
                break;
            case (3):
                System.out.println("购买完书本后还可以买可乐"+(money-book)/coke+"个,"+"还剩"+(money-coke*(money/coke))+"元");
                break;
            case (4):
                System.out.println("购买完书本后还可以买零食"+(money-book)/snacks+"个,"+"还剩"+(money-snacks*(money/snacks))+"元");
                break;
            default:
                System.out.println("输入错误，请重新输入");
        }
    }
}
